package GUI;

import javax.swing.*;
import layout.TableLayout;

/**
 *
 * @author Tim
 */
public class GeldStorten {

    /**
     *
     */
    public Controller gc;
    /**
     *
     */
    public Controllers.GeldStorten cgs;

    /**
     *
     */
    /**
     *
     */
    /**
     *
     */
    public JLabel huidigLabel, saldoLabel, bedragLabel;
    /**
     *
     */
    public JTextField saldoText;
    /**
     *
     */
    public JButton stortButton;

    double b = 10; // Border
    double f = TableLayout.FILL; // Fill
    double p = TableLayout.PREFERRED; //Preferred
    double vs = 5;// Vertical space between labels and text fields
    double vg = 10; // Vertical gap between form elements
    double hg = 10; // Horizontal gap between form elements

    /**
     *
     * @param gc
     */
    public GeldStorten(Controller gc) {
        this.gc = gc;
    }

    /**
     *
     */
    public void createGUI() {
        cgs = new Controllers.GeldStorten(this);
        gc.changeTitle("Geld storten");

        double size[][] = {
           //0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26
            {b, p, b, p, f}, // Cols
            {b, p, b, p, b, p, b, p, f} // Rows
        };

        gc.setLayout(new TableLayout(size));

        // Label en TextField maken
        huidigLabel = new JLabel("Huidig saldo"); saldoLabel = new JLabel(Double.toString(gc.spelerIngelogd.getSaldo()));
        bedragLabel = new JLabel("Bedrag"); saldoText = new JTextField(15);


        // Buttonpanel maken
        JPanel buttonPanel = new JPanel();
        stortButton = new JButton("Storten");
        stortButton.addActionListener(cgs);
        buttonPanel.add(stortButton);

        // Label en TextField toevoegen
        gc.add(huidigLabel, "1, 1"); gc.add(saldoLabel, "3, 1");
        gc.add(bedragLabel, "1, 3"); gc.add(saldoText, "3, 3");

        // Buttonpanel toevoegen
        gc.add(buttonPanel, "3, 5");
    }
}
